/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package model.creature.plant.plugin;

import java.awt.Image;
import model.creature.plant.MultiHarvestPlant;
import model.game.GameInterface;
import model.map.cell.PlantableCell;
import model.utility.ImageUtility;

/**
 * Cannot be harvested but acts as a tough wall.
 */
public class Tree extends MultiHarvestPlant {

  public Tree (GameInterface game, PlantableCell cell) {
    super(game, cell);
    hp_ = 200;
  }

  @Override
  protected String getFruitName() {
    assert false;
    return "";
  }

  @Override
  protected int timeToMature() {
    return 2;
  }

  @Override
  protected int timeToDie() {
    return 1000000000;
  }

  @Override
  protected int timeToHarvest(int harvest_count) {
    return 1000000000;
  }

  @Override
  protected int getHPAtCurrentLevel() {
    return 500 * getLevel() + 1000;
  }

  @Override
  public boolean canUpgrade() {
    return true;
  }

  @Override
  public int getUpgradeCost() {
    return 100;
  }

  @Override
  public void upgrade() {
    level_ += 1;
  }

  @Override
  public Image getImage() {
    if (is_seed_) {
      return ImageUtility.loadImage("resources/pictures/plants/tree/seed.png");
    } else {
      return ImageUtility.loadImage("resources/pictures/plants/tree/mature.png");
    }
  }

  @Override
  public String getName() {
    return "Tree";
  }

  @Override
  public String getSeason() {
    // all seasons
    return game_.getGameTime().getCurrentSeason().getName();
  }

  @Override
  public String getDescription() {
    return "After it grows, blocks the path of enemies. High Max HP but initial HP is low"
            + " (must be healed). During summer, healing on trees "
            + "has 150% "
            + "effect. Matures in 2 days. Does not bear a fruit. Grows in "
            + "all seasons. Initial HP is 200., initial max HP is 1000. Upgrade increases MaxHP";
  }

  @Override
  public void heal(int amount) {
    int real_amt = amount;
    if (game_.getGameTime().getCurrentSeason().getName().equals("Summer")) {
      real_amt *= 3;
      real_amt /= 2;
    }
    hp_ = Math.min(getHPAtCurrentLevel(), real_amt + hp_);
  }

}
